/*
 * geometricfigure.h
 *
 *  Created on: 19.01.2013
 *      Author: Michael
 */

#ifndef GEOMETRICFIGURE_H_
#define GEOMETRICFIGURE_H_

#include <stdlib.h>

struct _GeometricForm_t;

typedef struct _GeometricFormClass{
	// general
	struct _GeometricFormClass* pSuper;
	int size;

	// methods
	void (*init)(struct _GeometricForm_t* pThis);
	void (*draw)(struct _GeometricForm_t* pThis);
} GeometricFormClass_t;

typedef struct _GeometricForm_t {
	GeometricFormClass_t* pClass;
} GeometricForm_t;

GeometricFormClass_t class_geometricForm = {NULL, sizeof(GeometricFormClass_t), NULL, NULL};

GeometricForm_t* gf_construct(GeometricFormClass_t* pClass){
	GeometricForm_t* pGF = NULL;
	if(pClass->init != NULL){
		pGF = (GeometricForm_t*) malloc(pClass->size);
		pGF->pClass = pClass;
		pClass->init(pGF);
	}

	return pGF;
}

#endif /* GEOMETRICFIGURE_H_ */
